package com.integrate.kafka.controller;

import com.integrate.kafka.porducer.KafkaProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘志强
 * @date 2020/11/13 14:05
 */
@RestController
@Slf4j
@CrossOrigin
public class KafkaController {

    @Autowired
    private KafkaProducer kafkaProducer;

    @GetMapping("sendMsg")
    public String sendMsg(String msg) {
        kafkaProducer.send(msg);
        return "已发送";
    }
}
